<%@ page pageEncoding="utf-8" %>
<%@include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<fmt:bundle basename="res">
<head>
    <meta charset="utf-8">
    <title></title>
    <jsp:include page="/WEB-INF/commons/commons-header.jsp" flush="true"/>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">

            <div class="layui-form-item">
                <form name="totalForm" id="totalForm">

                    <div class="layui-inline">
                        <label class="layui-form-label" style="width: 80px;"><fmt:message key='mc'/></label>
                        <div class="layui-input-inline">
                            <input type="text" name="name" value="${params.name}" class="layui-input">
                        </div>
                    </div>



                    <div class="layui-inline">
                        <button class="layui-btn layui-btn-sm layuiadmin-btn-list" id="search"><i
                                class="layui-icon layui-icon-search layuiadmin-button-btn"></i> <fmt:message key='ss'/>
                        </button>
                    </div>
                </form>
            </div>
        </div>

    </div>

    <div class="layui-card">
        <div class="layui-field-box layui-form">

            <a href="javascript:void(0);" class="layui-btn layui-btn-sm layui-btn-normal" id="add"><i
                    class="layui-icon">&#xe61f;</i> <fmt:message key='xzfl'/></a>

            <table class="layui-table" lay-size="sm">
                <thead>
                <tr>
                    <td><fmt:message key='xh'/></td>
                    <th><fmt:message key='flmc'/></th>
                    <th><fmt:message key='cjsj'/></th>
                    <th><fmt:message key='cz'/></th>
                </tr>
                </thead>
                <c:forEach items="${page.result}" var="item" varStatus="status">
                    <tr>
                        <td>${status.index + 1}</td>
                        <td>${item.name}</td>
                        <td><fmt:formatDate value="${item.createTime}" type="both"/></td>
                        <td>
                            <div class="layui-btn-container">

                                <a href="javascript:void(0);" data-id="${item.id}"
                                   class="layui-btn layui-btn-normal layui-btn-xs feijin-modify"><fmt:message key='bj'/></a>
                                <a href="javascript:void(0);" data-id="${item.id}"
                                   class="layui-btn layui-btn-danger layui-btn-xs feijin-remove"><fmt:message key='sc'/></a>
                            </div>
                        </td>
                    </tr>
                </c:forEach>
            </table>
            <jsp:include page="/commons/page.jsp" flush="true"/>
        </div>
    </div>

</div>

<script>

    layui.use("layer", function () {

        //添加
        $("#add").click(function () {
            layer.open({
                type: 2,
                title: "<fmt:message key='tj'/>",
                content: "${web_domain}/live/channel/create",
                area: ["50%", "70%"],
                btn: ["<fmt:message key='qd'/>", "<fmt:message key='qx'/>"],
                yes: function (index, layero) {
                    layero.find('iframe').contents().find("#submit").click();
                }
            });
        });

        //编辑
        $(".feijin-modify").click(function () {
            var id = $(this).attr("data-id");
            layer.open({
                type: 2,
                content: "${web_domain}/live/channel/" + id + "/modify",
                area: ["50%", "70%"],
                btn: ["<fmt:message key='qd'/>", "<fmt:message key='qx'/>"],
                yes: function (index, layero) {
                    layero.find('iframe').contents().find("#submit").click();
                }
            });
        });

        //删除
        $(".feijin-remove").click(function () {
            var id = $(this).attr("data-id");
            layer.confirm("<fmt:message key='qrscm?'/>", function () {
                feijin.delete({
                    url: "${web_domain}/live/channel/remove",
                    data: {"id": id}
                });
            });
        })

    });
</script>
</body>
</fmt:bundle>
</html>
